package groovy;

import com.google.common.base.Preconditions;

/**
 * @author wangly on @date 2023/1/5
 */
public enum RuleConfigTemplatesEnum {

    INSURANCE_1_1("insurance-1-1","耗材限性别","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_1_2("insurance-1-2","药品限性别","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_1_3("insurance-1-3","诊疗项目限年龄","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_1_4("insurance-1-4","诊疗项目限性别","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_1_5("insurance-1-5","传染性筛查项目过度使用","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_2_1("insurance-2-1","医保限制药品使用范围","doFilterIsIns.json","doNull()","dealMedRuleBase()"),
    INSURANCE_2_2("insurance-2-2","医保限制诊疗项目适用范围","doFilterIsIns.json","doNull()","dealMedRuleBase()"),
    INSURANCE_2_4("insurance-2-4","中药饮片不予支付","doFilterIsIns.json","doNull()","dealMedRuleBase()"),
    INSURANCE_2_3("insurance-2-3","单独使用时不予支付，且全部由这些饮片组成的处方也不予支付","onlyMainNode.json","decoctionPiecesSingleOrCompound()","doNull()"),
    INSURANCE_3_7_A("insurance-3-7-A","诊疗项目限配套使用-不考虑数量","default.json","execExpress()","dealMedRuleBase()"),
    INSURANCE_3_7_B("insurance-3-7-B","诊疗项目限配套使用-考虑数量","default.json","execExpress()","dealMedRuleBase()"),
    INSURANCE_3_1("insurance-3-1","医嘱离院异常收取护理费用","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_3_4("insurance-3-4","诊疗项目超频次","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_3_5("insurance-3-5","诊疗项目超种类","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_3_6("insurance-3-6","诊疗项目超标准收费","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_3_9_A("insurance-3-9-A","诊疗项目同功能重复收费","default.json","execExpress()","dealMedRuleBase()"),
    INSURANCE_3_9_B("insurance-3-9-B","诊疗项目同功能重复收费","default.json","execExpress()","dealMedRuleBase()"),
    INSURANCE_3_8("insurance-3-8","诊疗项目内涵重复收费","default.json","execExpress()","dealMedRuleBase()"),
    INSURANCE_3_2("insurance-3-2","麻醉减收","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()"),
    INSURANCE_3_3("insurance-3-3","诊疗项目减收","onlyRuleBaseNode.json","doNull()","dealMedRuleBase()");

    /**
     * 规则编码
     */
    private String code;
    /**
     * 规则名称
     */
    private String name;
    /**
     * 规则对应的模板
     */
    private String template;
    /**
     * 规则对应的主表表达式
     */
    private String mainExpression;
    /**
     * 规则对应的附表表达式
     */
    private String ruleBaseExpression;

    RuleConfigTemplatesEnum(String code, String name, String template, String mainExpression, String ruleBaseExpression) {
        this.code = code;
        this.name = name;
        this.template = template;
        this.mainExpression = mainExpression;
        this.ruleBaseExpression = ruleBaseExpression;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getTemplate() {
        return template;
    }

    public String getMainExpression() {
        return mainExpression;
    }

    public String getRuleBaseExpression() {
        return ruleBaseExpression;
    }

    public static RuleConfigTemplatesEnum match(String code) {
        Preconditions.checkNotNull(code);
        for (RuleConfigTemplatesEnum codeEnum : values()) {
            if (code.equals(codeEnum.getCode())) {
                return codeEnum;
            }
        }
        return null;
    }
}
